<%@ page pageEncoding="utf-8" contentType="text/html" %>
<%@ include file="header.tpl.jsp"%>
<%@ page import="core.*" %>
<%
String[] template_keys = {"en", "zh-cn"};
String[] template_values = {"English", "简体中文"};
Object[] question_types = (Object[]) request.getAttribute("question_types[]");
%>

<form action="#" method="post">

<div class="box form">
	<h2>系统配置</h2>
	<table>
		<%if(Config.encryptKey == null || Config.encryptKey.isEmpty()){%>
		<tr><th>管理员密码</th><td><input type="text" id="adminPassword" name="adminPassword" /></td></tr>
		<tr><th>加密串</th><td><input type="text" id="encryptKey" name="encryptKey" value="<%=Config.encryptKey%>" /></td></tr>
		<%}else{%>
		<tr><th>加密串</th><td><input type="text" value="<%=Config.encryptKey%>" disabled="disabled" /></td></tr>
		<%}%>
		<tr><th>语言</th><td><%=View.select("template", template_keys, template_values, Config.template)%></td></tr>
		<tr><th>用户名最小长度</th><td><input type="text" id="usernameMinLength" name="usernameMinLength" value="<%=Config.usernameMinLength%>" /> - <%=Config.usernameMaxLength%></td></tr>
		<tr><th>密码最小长度</th><td><input type="text" id="passwordMinLength" name="passwordMinLength" value="<%=Config.passwordMinLength%>" /> - <input type="text" id="passwordMaxLength" name="passwordMaxLength" value="<%=Config.passwordMaxLength%>" /></td></tr>
		<tr><th>电子邮箱最大长度</th><td><input type="text" id="emailMaxLength" name="emailMaxLength" value="<%=Config.emailMaxLength%>" /></td></tr>
		<tr><th>消息窗显示时间</th><td><input type="text" id="messageTimeout" name="messageTimeout" value="<%=Config.messageTimeout%>" /></td></tr>
		<tr><th>可接受的考试延时</th><td><input type="text" id="acceptablePaperSubmitDelay" name="acceptablePaperSubmitDelay" value="<%=Config.acceptablePaperSubmitDelay%>" /></td></tr>
	</table>
</div>

<div class="box list">
	<h2>试卷类型</h2>
	<table>
		<thead><tr><td>类型号</td><td>类型名</td><td>父类型号</td><td>操作</td></tr></thead>
		<tbody>
			<%for(int i = 0; i < question_types.length; i++){%>
			<%QuestionType t = (QuestionType) question_types[i];%>
			<tr>
				<td><input type="text" id="questiontype_qtid[]" name="questiontype_qtid[]" value="<%=t.getQtid()%>" readonly="readonly" /></td>
				<td><input type="text" id="questiontype_name[]" name="questiontype_name[]" value="<%=t.getName()%>" /></td>
				<td><input type="text" id="questiontype_parenttype[]" name="questiontype_parenttype[]" value="<%=t.getParentType()%>" /></td>
				<td><a href="###" onclick="createNode(this)">[添加]</a> <a href="###" onclick="removeNode(this)">[删除]</a></td>
			</tr>
			<%}%>
		</tbody>
	</table>
</div>

<div class="post_buttons">
	<button type="submit">保存配置</button>
</div>

</form>

<%@ include file="footer.tpl.jsp"%>